{{ $styles := (site.Data.ui.styles) }}

<!--[ vendor-external ]-->
{{ with ($styles.vendor.external) }}
    {{ range . }}
      <link rel="preload" href="{{ . }}" as="style" crossorigin="anonymous"/>
      <link rel="stylesheet" href="{{ . }}" crossorigin="anonymous"/>
    {{ end }}
{{ end }}
<!--[ / vendor-external ]-->

<!--[ vendor-internal ]-->
{{ with ($styles.vendor.internal) }}
    {{ $bundle := slice }}
    {{ range . }}{{ $bundle = (($bundle) | append (resources.Get .)) }}{{ end }}
    {{ $bundle = (($bundle) | resources.Concat "css/vendor.bundle.css") }}
    {{ $bundle = (($bundle) | minify) }}
    <link rel="preload" href="{{ ($bundle.RelPermalink) }}" as="style"/>
    <link rel="stylesheet" href="{{ ($bundle.RelPermalink) }}"/>
{{ end }}
<!--[ / vendor-internal ]-->

<!--[ system-internal ]-->
{{ with ($styles.system.internal) }}
    {{ $bundle := slice }}
    {{ range . }}{{ $bundle = (($bundle) | append (resources.Get .)) }}{{ end }}
    {{ $bundle = (($bundle) | resources.Concat "css/system.bundle.scss") }}
    {{ $bundle = (($bundle) | resources.ExecuteAsTemplate ("css/system.bundle.scss" | relLangURL) .) }}
    {{ $bundle = ((($bundle) | resources.ToCSS) | minify) }}
    <link rel="preload" href="{{ ($bundle.RelPermalink) }}" as="style"/>
    <link rel="stylesheet" href="{{ ($bundle.RelPermalink) }}"/>
{{ end }}
<!--[ / system-internal ]-->
